/*
 * Conector.java
 *
 * Created on 8 de agosto de 2007, 13:16
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package gep.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author AdminPremiaLocal
 */
public class Conector {
    
    private static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
    private static final String DATABASE_URL = "jdbc:mysql://localhost/gep_db";
    private static final String USERNAME = "gepuser";
    private static final String PASSWORD = "gepuser";
    private java.sql.Connection con;
    private boolean connectedToDatabase = false;
    
    /** Creates a new instance of Conection */
    public Conector() throws ClassNotFoundException, SQLException {
        Class.forName(JDBC_DRIVER);
        con = DriverManager.getConnection(DATABASE_URL,USERNAME,PASSWORD);
        System.out.println("Driver cargado");
        connectedToDatabase = true;
    }
    
    public void close() throws SQLException{
        this.con.close();
    }
    
    public Connection getConnection(){
        return con;
    }
}
